<template>
  <div>
    <div class="player-box">
      <iframe
        height="562.5"
        width="1000"
        :src="movieSrc"
        frameborder="0"
        allowfullscreen="true"
      ></iframe>
    </div>
    <h2>{{MovieName}}</h2>
  </div>
</template>

<script>
import request from "../utils/request";
export default {
  name: "Player",
  components: {},
  data() {
    return {
      MovieId: null,
      movieSrc: null,
      MovieName: null,
    };
  },
  created() {},
  mounted() {
    this.getMovieById();
  },
  methods: {
    //根据id查询电影
    getMovieById() {
      this.MovieId = this.$route.query.id;
      console.log("接收到的id: " + this.MovieId);
      request.get("/movie/selectMovieById/" + this.MovieId).then((res) => {
        console.log("查询后的返回值" + res);
        //重点 将查询到的数据records 返回给表单中的tableData
        this.movieSrc = res.data.url;
        this.MovieName = res.data.name;
        console.log("查询后的this.movieSrc为: " + this.movieSrc);
      });
    },
  },
};
</script>

<style>
</style>